<?php
function getPerbandingan($atas,$bawah){
    if ($atas == 'A' && $bawah =='B'){
        return 2;
    }
    else if($atas == 'A' && $bawah =='C'){
        return 3;
    }
    else if($atas == 'A' && $bawah =='D'){
        return 4;
    }
    else if($atas == 'A' && $bawah =='E'){
        return 5;
    }
    else if($atas == 'B' && $bawah =='C'){
        return 2;
    }
    else if($atas == 'B' && $bawah =='D'){
        return 3;
    }
    else if($atas == 'B' && $bawah =='E'){
        return 4;
    }
    else if($atas == 'C' && $bawah =='D'){
        return 2;
    }
    else if($atas == 'C' && $bawah =='E'){
        return 3;
    }
    else if($atas == 'D' && $bawah =='E'){
        return 2;
    }
    else if ($atas == 'B' && $bawah =='A'){
        return 1/2;
    }
    else if($atas == 'C' && $bawah =='A'){
        return 1/3;
    }
    else if($atas == 'D' && $bawah =='A'){
        return 1/4;
    }
    else if($atas == 'E' && $bawah =='A'){
        return 1/5;
    }
    else if($atas == 'C' && $bawah =='B'){
        return 1/2;
    }
    else if($atas == 'D' && $bawah =='B'){
        return 1/3;
    }
    else if($atas == 'E' && $bawah =='B'){
        return 1/4;
    }
    else if($atas == 'D' && $bawah =='C'){
        return 1/2;
    }
    else if($atas == 'E' && $bawah =='C'){
        return 1/3;
    }
    else if($atas == 'E' && $bawah =='D'){
        return 1/2;
    }
    else{
        return 1;
    }
}

function getKepribadian($data){
    $kepribadian = (explode(",",$data));
    return $kepribadian;
}

function getLogika($nilai){
    $query = mysql_query("SELECT nilai FROM nilai_logika WHERE nilai_bawah <= '$nilai' AND $nilai <= nilai_atas;");
    $huruf = mysql_fetch_array($query);
    return $huruf[nilai];
}

function getKecermatan($nilai){
    $query = mysql_query("SELECT nilai FROM nilai_kecermatan WHERE nilai_bawah <= '$nilai' AND $nilai <= nilai_atas;");
    $huruf = mysql_fetch_array($query);
    return $huruf[nilai];
}

function getPelamar($idLowongan){
    $query = mysql_query("SELECT id_pelamar, logika, kecermatan, kepribadian, karakter FROM nilai_pelamar
                WHERE id_lowongan = '$idLowongan';");

    return $query;
}

function getNamaPelamar($idNama){
    $query = mysql_query("SELECT nama_pelamar FROM pelamar WHERE id = '$idNama';");
    $huruf = mysql_fetch_array($query);
    return $huruf[nama_pelamar];
}

function getLowongan($idLowongan){
    $query = mysql_query("SELECT lowongan FROM lowongan WHERE id = '$idLowongan';");
    $huruf = mysql_fetch_array($query);
    return $huruf[lowongan];
}

?>
